package top.ahzy.seobench.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.ahzy.seobench.result.Result;
import top.ahzy.seobench.service.MusicService;

import javax.validation.constraints.NotEmpty;

@Api(tags = "音乐")
@RestController
@RequestMapping("/music")
public class MusicController {

    @Autowired
    private MusicService musicService;

    @GetMapping("/searchMp3")
    @ApiOperation(value = "搜索音乐",notes = "")
    public Result searchMp3(@RequestParam  @NotEmpty(message = "音乐名称")String musicName){
        return musicService.searchMp3(musicName);
    }

    @GetMapping("/getMp3")
    @ApiOperation(value = "获取音乐",notes = "")
    public Result getMp3(@RequestParam  @NotEmpty(message = "音乐ID")String musicId){
        return musicService.getMp3(musicId);
    }
}
